Inside Macintosh: QuickTime

Previous | Chapter Top | Chapter Contents | Next

Working With Graphics Devices and Graphics Worlds

This section describes two Image Compression Manager functions that enable you to select graphics devices and create graphics worlds. You can use the GetBestDeviceRect function to select the best available graphics device. The NewImageGWorld function allows you to create a graphics world based on the width, height, depth, and color table of a specified image description structure.

GetBestDeviceRect

The GetBestDeviceRect function selects the deepest of all available graphics devices, while treating 16-bit and 32-bit screens as having equal depth.

pascal OSErr GetBestDeviceRect (GDHandle *gdh, Rect *rp);
gdh
Contains a pointer to the handle of the rectangle for the chosen device. If you do not need the information in this parameter returned, specify nil .
rp
Contains a pointer to the rectangle that is adjusted for the height of the menu bar if the device is the main device. If you do not need the information in this parameter returned, specify nil .

DESCRIPTION

If multiple 16-bit and 32-bit monitors are available, the GetBestDeviceRect function selects the 16-bit or 32-bit device upon which the cursor has currently been detected. If a cursor is not on one of the devices in question, the first of those in the list is chosen.

Note that the GetBestDeviceRect function does not center a rectangle on a device. Rather, it returns the rectangle for the best device.

NewImageGWorld

The NewImageGWorld function creates a graphics world from the width, height, depth, and color table of a specified image-description structure.

pascal OSErr NewImageGWorld (GWorldPtr *gworld,
                                         ImageDescriptionHandle idh,
                                         GWorldFlags flags);
gworld
Contains a pointer to a graphic world created using the width, height, depth, and color table specified in the image description structure pointed to in the idh parameter.
idh
Contains a handle to an image description structure with information for the graphics world pointed to by the gworld parameter.
flags
Contains graphics world flags. These flags are passed directly through to the NewGWorld function. (For details on NewGWorld , see Inside Macintosh: Devices .)

DESCRIPTION

The NewImageGWorld function selects the appropriate color table using the depth field or custom color table in the image description structure. It creates a 32-bit-deep graphics world if the depth specified in the image description structure is 24.

SPECIAL CONSIDERATIONS

You are responsible for disposing of the graphics world with the DisposeGWorld routine. (For more on DisposeGWorld , see Inside Macintosh: Devices .)

RESULT CODES

noErr

0

No error

paramErr

-50

Invalid parameter specified

cDepthErr

-157

Invalid pixel resolution


© 1997 Apple Computer, Inc.

Previous | Chapter Top | Chapter Contents | Next